<?php
namespace web\util;

class WebUtil{
    
    /**
     * @desc 状态名称
     * @param number $status
     * @return string
     */
    public static  function getStatusName($status){
        switch ($status){
            case 0:
                return '未审核';
            case 1:
                return '已审核';
            case 2:
                return '被驳回';
        }
    }
    
    /**
    * @desc 银行卡类型 
    * @param number $paytype
    * @return string
    */
    public static  function getPaymentTypeName($paytype){
        switch ($paytype){
            case 1:
                return '银行卡';
            case 2:
                return '支付宝';
        }
    }
    
    /**
     * @desc 充值类型
     * @param number $recharge_type
     * @return string
     */
    public  static function getRechargeType($recharge_type){
        switch ($recharge_type){
            case 1:
                return '前台申请充值';
            case 2:
                return '后台充值';
        }
        return '申请充值';
    }
    
    
    /**
     * @desc 提现类型
     * @param int $withdraw_type
     * @return string
     */
    public  static function getWithdrawType($withdraw_type){
        switch ($withdraw_type){
            case 1:
                return '申请提现';
        }
        return '申请提现';
    }
    
    public static function getPaytypeName($paytype){
        switch ($paytype){
            case 1:
                return '银行卡';
            case 2:
                return '支付宝';
            case 3:
                return '微信支付';
        }
    }
    
    public static function getGradeName($grade) {
        switch ($grade){
            case 1:
                return '品正商';
            case 2:
                return '品正商V';
        }
    }
    
    public static function getOrderStatusName($ispay,$flag = 0){
        switch ($ispay){
            case 1:
                if($flag == 1){
                    return '已备货';
                }else{
                    return '未发货';
                }
            case 2:
                return '已取消';
            case 3:
                return '已发货';
            case 4:
                return '退换货';
            case 5:
                return '已完成';
        }
    }
    
    /**
     * 获取奖励金额
     */
    public static function getRewardPrice($values,$count){
        if(empty($values)){
            return 0;
        }
        foreach ($values as $k => $val){
            if($count >= $k ){
               return $val;
            }
        }
        return 0;
    }
}